# -*- coding: utf-8 -*-
# @Time : 2021/3/30 12:13 
# @Author : for 
# @File : comment_form_tags.py 
# @Motto: good good study,day day up


from django import template
from ..forms import CommentForm

register = template.Library()


@register.inclusion_tag('comments/inclusions/_form.html', takes_context=True)
def show_comment_form(context, blog, form=None):
    if form is None:
        form = CommentForm()
    return {
        'form': form,
        'blog': blog,
        'comment_form': context['comment_form'],
        'msg': context['msg']
    }
